package com.jlpay.openapi.demo.ledger.merchconf;

import com.jlpay.open.jlpay.sdk.java.model.ledger.request.MerchRevBindRequest;
import com.jlpay.open.jlpay.sdk.java.model.ledger.response.MerchRevBindResponse;
import com.jlpay.open.jlpay.sdk.java.utils.json.JsonUtils;
import com.jlpay.openapi.demo.JlpayOpenApiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Arrays;

/**
 *
 * @author dengwenning
 * @since 2024/8/30
 **/
public class MerchRevBindService {

    private static final Logger LOGGER = LoggerFactory.getLogger(MerchRevBindService.class);

    public static void main(String[] args) {
        MerchRevBindRequest merchRevBindRequest = buildMerchFileUploadRequest();
        MerchRevBindResponse merchRevBindResponse = JlpayOpenApiService.openMerchService()
                .post(merchRevBindRequest, MerchRevBindResponse.class);
        LOGGER.info("分账配置绑定入账方响应:{}", JsonUtils.toString(merchRevBindResponse));
    }

    private static MerchRevBindRequest buildMerchFileUploadRequest() {
        MerchRevBindRequest merchRevBindRequest = new MerchRevBindRequest();
        merchRevBindRequest.setOrgCode("50720711");
        merchRevBindRequest.setMchId("849581183510017");
        merchRevBindRequest.setRevMchId("849584307420004");
        merchRevBindRequest.setNotifyUrl("https://api.mch.weixin.qq.com/sns/notify");
        merchRevBindRequest.setSourceIds(Arrays.asList("jlpay/2024-08-30/e22bc590f433418483626fded04f3362.png", "jlpay/2024-08-30/e22bc590f433418483626fded04f3363.png"));
        return merchRevBindRequest;
    }
}
